﻿<!DOCTYPE HTML>
<script src="../../resources/js-test.js"></script>
<script src="../dom/resources/event-sender-util.js"></script>
<script>
  var inputNode;
  var X,Y;
  var event;
  description('Verifies that when element is focused in frames then selection'+
    ' by menu key, context menu should come on focused element. Succeeds if '+
    'context menu is coming on the focused element and event co-ordinates are'+
    ' at center of the elements bounding box.');
  function onEventInFrame(e) {
    event = e;
    shouldBe("event.target", "inputNode");
    shouldBe("event.clientX", "X");
    shouldBe("event.clientY", "Y");
  }
  function runTest() {
    if (window.testRunner)
         testRunner.dumpAsText();
    if (!window.eventSender)
        return;
    inputNode = frames[0].document.getElementById("ex1");
    var r = inputNode.getBoundingClientRect();
    X = (r.left + r.right) / 2
    Y = (r.top + r.bottom) / 2;
    inputNode.focus();
    eventSender.keyDown("ContextMenu");
  }
</script>
<iframe id="myframe" style="margin-top:50px" onload="runTest()" src="resources/menu-key-context-menu-position-frame.html"><iframe>
